﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SalaryMS
{
    public partial class SalaryEmpSearch : Form
    {
        public SalaryEmpSearch()
        {
            InitializeComponent();
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            String EmpId = txtEmpId.Text.Trim().ToString();
            if (EmpId.Length > 0)
            {
                String sql = "SELECT SalaryDate,BankAccount,Money,EmpName FROM Salary WHERE EmpId='"+EmpId+"'";
                DataTable dt = DBSession.ExecuteDataTable(sql, null);
                if (dt != null && dt.Rows.Count > 0)
                {
                    dgvEmpSalary.DataSource = dt;
                }
                else
                {
                    dgvEmpSalary.DataSource = null;
                    MessageBox.Show("没有该员工的薪资记录，请检查员工ID号是否正确！");
                }
            }
            else
            {
                MessageBox.Show("员工ID号不能为空！");
            }
        }
    }
}
